# -*- coding: utf-8 -*-
"""
Created on Wed Jul 17 08:45:25 2024

@author: LoongFly
"""

import cv2
import numpy as np
img_input = cv2.imread("H:\\PycharmProjects\\OpenCV\\A3_Morphology\\photo\\lena.png", cv2.IMREAD_UNCHANGED)
# img_input = cv2.imread("A4_ImageGradient\\egde.png",cv2.IMREAD_UNCHANGED)

# # 使用sobel算子计算图像梯度
Laplacian_Img = cv2.Laplacian(img_input, cv2.CV_64F)     #计算x方向上的梯度
Laplacian_Img = cv2.convertScaleAbs(Laplacian_Img)                #将梯度转换为无符号8位整数

cv2.imshow("Original", img_input)       #显示原始图像
cv2.imshow("Laplacian", Laplacian_Img) 

cv2.waitKey()
cv2.destroyAllWindows()
